import {
  exportUrl,
  downloadTemplateUrl,
  getDiffStatusList,
  getScanFlagList,
  getCloseFlagList,
  getDiffTypeList
} from "@/api/checkorder/mesOrderCheckDiff"
import { getDict } from "@/api/common"
import { getCurrentWarehouseCode } from "@/api/inbound/mesInTask"

// 列表头按钮配置
export const operateList = [
  {
    name: $i18n.t("common.export"),
    type: "primary",
    icon: "el-icon-download",
    handleName: "export", //点击时返回的标识
    url: exportUrl,
  },
  {
    name: $i18n.t("差异处理"),
    type: "primary",
    icon: "el-icon-circle-plus-outline",
    isMultiple: true,
    handleName: "handle", //点击时返回的标识
  }
]

// 搜索条件配置
export const searchConfig = {
  inline: true,
  formDesc: {
    orderNo: {
      type: "input",
      label: $i18n.t("单据编号") // 单据编号
    },
    goodsCode: {
      type: "input",
      label: $i18n.t("商品编码") // 商品编码
    },
    // warehouseCode: {
    //   type: "select",
    //   prop: {
    //     value: "modelingCode",
    //     text: "modelingName"
    //   },
    //   options: async (data) => {
    //     const res = await getCurrentWarehouseCode();
    //     let list = res.data.result || []
    //     list.forEach(val => {
    //       val.modelingName = `${val.modelingCode}-${val.modelingName}`
    //     });
    //     return list;
    //   },
    //   label: $i18n.t("common.warehouse") // 仓库编码
    // },
    diffStatus: {
      label: $i18n.t("差异状态"), // 差异状态
      type: "select",
      prop: {
        value: "value",
        text: "description"
      },
      options: async (data) => {
        const list = await getDict("wms_pd_diff_status")
        return list.data.result
      }
    },
    closeFlag: {
      label: $i18n.t("是否处理"), // "是否处理",
      type: "select",
      prop: {
        value: "value",
        text: "description"
      },
      options: async (data) => {
        const list = await getCloseFlagList()
        return list.data.result
      }
    }
  }
}
// 新增/删除表单配置
export const formDescDialog = {
  span: 24,
  disabled: false,
  labelPosition: "left",
  isShowSubmitBtn: true,
  formDesc: {
    handlingMethod: {
      layout: 24,
      type: "radio",
      label: $i18n.t("是否复盘"), // 是否复盘
      prop: {
        value: "value",
        text: "description"
      },
      options: async (data) => {
        const list = await getDict("wms_pd_handling_method")
        return list.data.result
      },
      required: true
    },
    diffType: {
      layout: 24,
      type: "select",
      label: $i18n.t("差异类型"), // 差异类型
      prop: {
        value: "value",
        text: "description"
      },
      options: async (data) => {
        const list = await getDict("wms_pd_diff_type")
        return list.data.result
      },
      required: true
    },
    diffDesc: {
      layout: 24,
      type: "textarea",
      label: $i18n.t("差异描述"), // 差异类型
      attrs: {
        rows: 3
      }
    }
  }
}
